<!DOCTYPE html>
<html lang="zh-CN">
    <head>
    <meta charset="utf-8">

    

    <!-- 渲染优化 -->
    <meta name="renderer" content="webkit">
    <meta name="force-rendering" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="HandheldFriendly" content="True" >
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <!--icon-->

    
        <link rel="shortcut icon" href="https://s1.imgpp.com/2022/01/28/owl.png">
    
    
    
    
    


    <!-- meta -->


<title>vue中操作数组的方法 | 猫头鹰的BLOG</title>


    <meta name="keywords" content="vue, 数组方法, 猫头鹰的博客">




    <!-- OpenGraph -->
 
    <meta name="description" content="vue中操作数组的方法以下方法会改变原数组push() 像数组末尾添加一个元素，返回一个新的长度  var arr1&#x3D;[1,2,3] console.log(arr1.push(3));  pop() 删除最后一个元素并返回他的值  var arr2&#x3D;[1,2,3] console.log(arr2.pop());  shift() 删除第一个元素并返回他的值  var arr3&#x3D;[1,2,3]">
<meta property="og:type" content="article">
<meta property="og:title" content="vue中操作数组的方法">
<meta property="og:url" content="http://example.com/2022/03/02/vue%E4%B8%AD%E6%93%8D%E4%BD%9C%E6%95%B0%E7%BB%84%E7%9A%84%E6%96%B9%E6%B3%95/index.html">
<meta property="og:site_name" content="猫头鹰的BLOG">
<meta property="og:description" content="vue中操作数组的方法以下方法会改变原数组push() 像数组末尾添加一个元素，返回一个新的长度  var arr1&#x3D;[1,2,3] console.log(arr1.push(3));  pop() 删除最后一个元素并返回他的值  var arr2&#x3D;[1,2,3] console.log(arr2.pop());  shift() 删除第一个元素并返回他的值  var arr3&#x3D;[1,2,3]">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://images.pexels.com/photos/7034504/pexels-photo-7034504.jpeg?cs=srgb&dl=pexels-george-milton-7034504.jpg&fm=jpg">
<meta property="article:published_time" content="2022-03-02T02:00:20.000Z">
<meta property="article:modified_time" content="2022-04-12T12:41:20.218Z">
<meta property="article:author" content="张程">
<meta property="article:tag" content="vue">
<meta property="article:tag" content="数组方法">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://images.pexels.com/photos/7034504/pexels-photo-7034504.jpeg?cs=srgb&dl=pexels-george-milton-7034504.jpg&fm=jpg">


    
<link rel="stylesheet" href="/css/style/main.css">
 

    
    
    
        <link rel="stylesheet" id="hl-default-theme" href="https://cdn.jsdelivr.net/npm/highlight.js@10.1.2/styles/arduino-light.min.css" media="none" >
        
            <link rel="stylesheet" id="hl-dark-theme" href="https://cdn.jsdelivr.net/npm/highlight.js@10.1.2/styles/obsidian.min.css" media="none">
        
    

    

    
    
<link rel="stylesheet" href="/css/style/dark.css">

    
<script src="/js/darkmode.js"></script>



     
    <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
 

    <!-- custom head -->

<meta name="generator" content="Hexo 6.0.0"></head>

    <body>
        <div id="app">
            <header class="header">
    <div class="header__left">
        <a href="/" class="button">
            <span class="logo__text">猫头鹰</span>
        </a>
    </div>
    <div class="header__right">
        
            <div class="navbar__menus">
                
                    <a href="/" class="navbar-menu button">首页</a>
                
                    <a href="/tags/" class="navbar-menu button">标签</a>
                
                    <a href="/categories/" class="navbar-menu button">分类</a>
                
                    <a href="/archives/" class="navbar-menu button">归档</a>
                
            </div>
        
        
        
    <a href="/search/" id="btn-search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="24" height="24" fill="currentColor" stroke="currentColor" stroke-width="32"><path d="M192 448c0-141.152 114.848-256 256-256s256 114.848 256 256-114.848 256-256 256-256-114.848-256-256z m710.624 409.376l-206.88-206.88A318.784 318.784 0 0 0 768 448c0-176.736-143.264-320-320-320S128 271.264 128 448s143.264 320 320 320a318.784 318.784 0 0 0 202.496-72.256l206.88 206.88 45.248-45.248z"></path></svg>
    </a>


        
        
    <a href="javaScript:void(0);" id="btn-toggle-dark">
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
    </a>


        
            <a class="dropdown-icon button" id="btn-dropdown" tabindex="0"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width='24' height='24' fill="none" stroke="currentColor" stroke-width="0.7" stroke-linecap="round" stroke-linejoin="round"><path fill="currentColor" d="M3.314,4.8h13.372c0.41,0,0.743-0.333,0.743-0.743c0-0.41-0.333-0.743-0.743-0.743H3.314c-0.41,0-0.743,0.333-0.743,0.743C2.571,4.467,2.904,4.8,3.314,4.8z M16.686,15.2H3.314c-0.41,0-0.743,0.333-0.743,0.743s0.333,0.743,0.743,0.743h13.372c0.41,0,0.743-0.333,0.743-0.743S17.096,15.2,16.686,15.2z M16.686,9.257H3.314c-0.41,0-0.743,0.333-0.743,0.743s0.333,0.743,0.743,0.743h13.372c0.41,0,0.743-0.333,0.743-0.743S17.096,9.257,16.686,9.257z"></path></svg></a>
            <div class="dropdown-menus" id="dropdown-menus">
                
                    <a href="/" class="dropdown-menu button">首页</a>
                
                    <a href="/tags/" class="dropdown-menu button">标签</a>
                
                    <a href="/categories/" class="dropdown-menu button">分类</a>
                
                    <a href="/archives/" class="dropdown-menu button">归档</a>
                
            </div>
        
    </div>
</header>


            <main class="main">
    

<div class="post-title">
    <h1 class="post-title__text">
        vue中操作数组的方法
    </h1>
    <div class="post-title__meta">
        <a href="/archives/2022/03/" class="post-meta__date button">2022-03-02</a>
        
    <span class="separate-dot"></span><a href="/categories/Vue2/" class="button">Vue2</a>

 
        
    
     
    <span id="busuanzi_container_page_pv" hidden>
        <span class="separate-dot"></span>
        <span></span>
        <span id="busuanzi_value_page_pv"></span>
        <span>次观看</span>
    </span>



 

 
    </div>
</div>



<article class="post content-card">
    <div class="post__header">
    
        <div class="post-thumbnail lazy" data-bg="https://images.pexels.com/photos/7034504/pexels-photo-7034504.jpeg?cs=srgb&amp;dl=pexels-george-milton-7034504.jpg&amp;fm=jpg"></div>
    
</div>
    <div class="post__content">
        <blockquote class="blockquote-note blockquote-note__info"><div class="blockquote-note__header"><div class="blockquote-note__icon"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></div>vue中操作数组的方法</div><div class="blockquote-note__content"><h1 id="以下方法会改变原数组"><a href="#以下方法会改变原数组" class="headerlink" title="以下方法会改变原数组"></a>以下方法会改变原数组</h1><h2 id="push"><a href="#push" class="headerlink" title="push()"></a>push()</h2><blockquote>
<p>像数组末尾添加一个元素，返回一个新的长度</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr1=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>]
<span class="hljs-built_in">console</span>.log(arr1.push(<span class="hljs-number">3</span>));</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image.png" srcset="" alt="效果图"></p>
<h2 id="pop"><a href="#pop" class="headerlink" title="pop()"></a>pop()</h2><blockquote>
<p>删除最后一个元素并返回他的值</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr2=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>]
<span class="hljs-built_in">console</span>.log(arr2.pop());</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/imagec5df587c3ac764b6.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/imagec5df587c3ac764b6.png" srcset="" alt="效果图"></p>
<h2 id="shift"><a href="#shift" class="headerlink" title="shift()"></a>shift()</h2><blockquote>
<p>删除第一个元素并返回他的值</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr3=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>]
<span class="hljs-built_in">console</span>.log(arr3.shift());</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image4916e51c485611f2.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image4916e51c485611f2.png" srcset="" alt="效果图"></p>
<h2 id="unshift"><a href="#unshift" class="headerlink" title="unshift()"></a>unshift()</h2><blockquote>
<p>开头添加一个元素并返回他的值</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr4=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>]
<span class="hljs-built_in">console</span>.log(arr4.unshift(<span class="hljs-number">4</span>));
<span class="hljs-built_in">console</span>.log(arr4);</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image73041e8087e6525b.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image73041e8087e6525b.png" srcset="" alt="效果图"></p>
<h2 id="splice-index-deleteNum-add1-add2-add3"><a href="#splice-index-deleteNum-add1-add2-add3" class="headerlink" title="splice(index,deleteNum,add1,add2,add3)"></a>splice(index,deleteNum,add1,add2,add3)</h2><blockquote>
<p>(拼接)删除/添加/替换一个或n个元素，返回被删掉元素组成的数组<br>index:开始的位置<br>deleteNum:删除元素的数量<br>add:添加的元素</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr5=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>]
<span class="hljs-built_in">console</span>.log(arr5.splice());
<span class="hljs-built_in">console</span>.log(arr5);</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/imagee9d92eb5090588d9.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/imagee9d92eb5090588d9.png" srcset="" alt="效果图"></p>
<h2 id="sort-i-j-gt-return-i-j-j-i"><a href="#sort-i-j-gt-return-i-j-j-i" class="headerlink" title="sort((i,j)=&gt;return i-j/j-i)"></a>sort((i,j)=&gt;return i-j/j-i)</h2><blockquote>
<p>排序<br>return i-j:升序（默认）<br>return j-i:降序</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr6=[<span class="hljs-number">7</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">0</span>]
<span class="hljs-built_in">console</span>.log(arr6.sort(<span class="hljs-function">(<span class="hljs-params">i,j</span>)=&gt;</span>&#123;
    <span class="hljs-keyword">return</span> i-j
&#125;));</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image1b6332167a1c53b3.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image1b6332167a1c53b3.png" srcset="" alt="效果图"></p>
<h2 id="reverse"><a href="#reverse" class="headerlink" title="reverse()"></a>reverse()</h2><blockquote>
<p>反转</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr7=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>]
<span class="hljs-built_in">console</span>.log(arr7.reverse());</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image2c42539095d61886.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image2c42539095d61886.png" srcset="" alt="效果图"></p>
<h1 id="以下方法不会改变原数组"><a href="#以下方法不会改变原数组" class="headerlink" title="以下方法不会改变原数组"></a>以下方法不会改变原数组</h1><h2 id="filter-el-index-gt-return"><a href="#filter-el-index-gt-return" class="headerlink" title="filter((el,index)=&gt;{return *})"></a>filter((el,index)=&gt;{return *})</h2><blockquote>
<p>过滤,返回一个新数组</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr8=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>]
<span class="hljs-built_in">console</span>.log(arr8.filter(<span class="hljs-function">(<span class="hljs-params">el,index</span>)=&gt;</span>&#123;
    <span class="hljs-keyword">return</span> el!==<span class="hljs-number">1</span>
&#125;));</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image25808513f8429792.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image25808513f8429792.png" srcset="" alt="效果图"></p>
<h2 id="concat-arr1-arr2-arr3-…"><a href="#concat-arr1-arr2-arr3-…" class="headerlink" title="concat(arr1,arr2,arr3,…)"></a>concat(arr1,arr2,arr3,…)</h2><blockquote>
<p>连接,返回一个新数组</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr9=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>]
<span class="hljs-keyword">var</span> arr10=[<span class="hljs-number">3</span>,<span class="hljs-number">4</span>]
arr11=[<span class="hljs-number">5</span>,<span class="hljs-number">6</span>]
arr12=[]
<span class="hljs-built_in">console</span>.log(arr12.concat(arr9,arr10,arr11));
<span class="hljs-built_in">console</span>.log(arr12);</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image8b00730267e8beaa.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image8b00730267e8beaa.png" srcset="" alt="效果图"></p>
<h2 id="slice-startindex-endindex"><a href="#slice-startindex-endindex" class="headerlink" title="slice(startindex,endindex)"></a>slice(startindex,endindex)</h2><blockquote>
<p>切,返回选定的数组(不包尾)<br>slice(startindex):选取开头一直到结尾</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr13=[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>]
<span class="hljs-built_in">console</span>.log(arr13.slice(<span class="hljs-number">0</span>,<span class="hljs-number">1</span>));
<span class="hljs-built_in">console</span>.log(arr13);</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/image60aaf1dfff90e0d3.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/image60aaf1dfff90e0d3.png" srcset="" alt="效果图"></p>
<h1 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h1><h2 id="split"><a href="#split" class="headerlink" title="split()"></a>split()</h2><blockquote>
<p>将字符串按照内部指定的字符串分割为字符串数组</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> str=<span class="hljs-string">&#x27;1,2,3,4,5&#x27;</span>
<span class="hljs-built_in">console</span>.log(str.split(<span class="hljs-string">&#x27;,&#x27;</span>));</code></pre>
<p><img src="https://imgpp.com/s1/2022/03/02/imageabfb3adb5cc7aaa9.png" class="lazy" data-srcset="https://imgpp.com/s1/2022/03/02/imageabfb3adb5cc7aaa9.png" srcset="" alt="效果图"></p>
<h2 id="reduce-累加结果-当前项的值，当前项的索引-gt-，初始值"><a href="#reduce-累加结果-当前项的值，当前项的索引-gt-，初始值" class="headerlink" title="reduce((累加结果,当前项的值，当前项的索引)=&gt;{}，初始值 )"></a>reduce((累加结果,当前项的值，当前项的索引)=&gt;{}，初始值 )</h2><blockquote>
<p>接受一个函数作为累加器，将元素从左到右逐一缩减，最终变为一个值<br>i:累加的结果<br>j:当前循环项<br>k:当前项的索引</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">return</span> arr.reduce(<span class="hljs-function">(<span class="hljs-params">i,j</span>)=&gt;</span>&#123;
	<span class="hljs-keyword">return</span> i+j
&#125;)</code></pre>

<h2 id="join"><a href="#join" class="headerlink" title="join()"></a>join()</h2><blockquote>
<p>参数：字符串类型的分隔符<br>将数组转为字符串</p>
</blockquote>
<pre><code class="hljs javascript"><span class="hljs-keyword">var</span> arr = [<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>]
<span class="hljs-keyword">var</span> str = arr.join(<span class="hljs-string">&#x27;&#x27;</span>)
<span class="hljs-built_in">console</span>.log(str);</code></pre>
<blockquote>
<p>结果：123</p>
</blockquote>
<h1 id="循环"><a href="#循环" class="headerlink" title="循环"></a>循环</h1><h2 id="forEach"><a href="#forEach" class="headerlink" title="forEach()"></a>forEach()</h2><blockquote>
<p>一旦开始，就停不下来，也不能用break</p>
</blockquote>
<h2 id="some"><a href="#some" class="headerlink" title="some()"></a>some()</h2><blockquote>
<p>可以通过return 终止这个函数</p>
</blockquote>
<h2 id="every"><a href="#every" class="headerlink" title="every()"></a>every()</h2><blockquote>
<p>判读数组的每个元素是否都能通过每个指定函数的测试，返回布尔值<br>用于商品的全选按钮</p>
</blockquote>
</div></blockquote>
    </div>
     
    <div class="post-footer__meta"><p>更新于 2022-04-12</p></div> 
    <div class="post-entry__tags"><a href="/tags/vue/" class="post-tags__link button"># vue</a><a href="/tags/%E6%95%B0%E7%BB%84%E6%96%B9%E6%B3%95/" class="post-tags__link button"># 数组方法</a></div> 
</article>


    <div class="nav">
        <div class="nav__prev">
            
                <a href="/2022/03/03/JavaScript%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" class="nav__link">
                    <div>
                        <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M589.088 790.624L310.464 512l278.624-278.624 45.248 45.248L400.96 512l233.376 233.376z" fill="#808080"></path></svg>
                    </div>
                    <div>
                        <div class="nav__label">
                            <!-- Previous Post -->
                            上一页
                        </div>
                        <div class="nav__title">
                            js函数
                        </div>
                    </div>
                </a>
            
        </div>
        <div class="nav__next">
            
                <a href="/2022/02/21/Bootstrap%E6%A0%85%E6%A0%BC%E7%B3%BB%E7%BB%9F/" class="nav__link">
                    <div>
                        <div class="nav__label">
                            <!-- Next Post -->
                            下一页
                        </div>
                        <div class="nav__title">
                            Bootstrap栅格系统
                        </div>
                    </div>
                    <div>
                        <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M434.944 790.624l-45.248-45.248L623.04 512l-233.376-233.376 45.248-45.248L713.568 512z" fill="#808080"></path></svg>
                    </div>
                </a>
            
        </div>
    </div>



    <div class="post__comments content-card" id="comment">
        
    <h4>评论</h4>
    
    
    
    <div id="valine_container" class="valine_thread"></div>

    
    
    
    
    
    
    
    


    </div>



</main>

            <footer class="footer" style="font-size: 10px;">
     
    <a href="#" class="button" id="b2t" aria-label="回到顶部" title="回到顶部">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="32" height="32">
            <path d="M233.376 722.752L278.624 768 512 534.624 745.376 768l45.248-45.248L512 444.128zM192 352h640V288H192z" fill="currentColor"></path>
        </svg>
    </a>

    


    
    
    
        <span id="busuanzi_container_site_uv" hidden>
            <span>游客:</span>
            <span id="busuanzi_value_site_uv"></span>
            <span></span>
            
                <span> </span>
            
        </span>
    
    
        <span id="busuanzi_container_site_pv" hidden>
            <span>次数:</span>
            <span id="busuanzi_value_site_pv"></span>
            <span></span>
            
        </span>
    
 
 

 
    
    
    <p>
        <!-- Powered by <a href="https://hexo.io" target="_blank">Hexo</a> | Theme - <a href="https://github.com/ChrAlpha/hexo-theme-cards" target="_blank">Cards</a> -->
        <span style="color: black;">作者：张程</span>
    </p>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
    </script>
    <script>
        var a_idx = 0;
            jQuery(document).ready(function($) {
                $("body").click(function(e) {
                    var a = new Array("会当凌绝顶，一览众山小", "春蚕到死丝方尽，蜡炬成灰泪始干", "夕阳无限好，只是近黄昏",
                     "位卑未敢忘忧国", "纸上得来终觉浅，绝知此事要躬行", "人生自古谁无死，留取丹心照汗青", "山重水复疑无路，柳暗花明又一村" ,
                     "小荷才露尖尖角，早有蜻蜓立上头", "床前明月光，疑是地上霜", "春色满园关不住，一枝红杏出墙来", 
                     "山际见来烟，竹中窥落日", "道狭草木长，夕露沾我衣","天长地久有时尽，此恨绵绵无绝期");
                    var color = new Array("#7B7B7B", "#CE0000", "#FF0080","#E800E8","#921AFF","#2828FF",
                    "#0072E3","#00CACA","#02DF82","#00DB00","#8CEA00","#E1E100","#EAC100","#F75000"
                    ,"#B87070","#AFAF61","#6FB7B7","#9999CC","#B766AD");
                    var $i = $("<a href='#' style='text-decoration:none'/>").text(a[a_idx]);
                    a_idx = (a_idx + 1) % a.length;
                    var x = e.pageX,
                        y = e.pageY;
                    $i.css({
                        "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
                        "top": y - 20,
                        "left": x,
                        "position": "absolute",
                        "font-weight": "bold",
                        "color": color[Math.floor(Math.random()*color.length)]
                    });
                    $("body").append($i);
                    $i.animate({
                            "top": y - 180,
                            "opacity": 0
                        },
                        1500,
                        function() {
                            $i.remove();
                        });
                });
            });
        </script>
    <script>
        !function() {
            function o(w, v, i) {
                return w.getAttribute(v) || i
            }
            function j(i) {
                return document.getElementsByTagName(i)
            }
            function l() {
                var i = j("script"),
                w = i.length,
                v = i[w - 1];
                return {
                    l: w,
                    z: o(v, "zIndex", -1),
                    o: o(v, "opacity", 0.5),
                    c: o(v, "color", "0,0,0"),
                    n: o(v, "count", 99)
                }
            }
            function k() {
                r = u.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
                n = u.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
            }
            function b() {
                e.clearRect(0, 0, r, n);
                var w = [f].concat(t);
                var x, v, A, B, z, y;
                t.forEach(function(i) {
                    i.x += i.xa,
                    i.y += i.ya,
                    i.xa *= i.x > r || i.x < 0 ? -1 : 1,
                    i.ya *= i.y > n || i.y < 0 ? -1 : 1,
                    e.fillRect(i.x - 0.5, i.y - 0.5, 1, 1);
                    for (v = 0; v < w.length; v++) {
                        x = w[v];
                        if (i !== x && null !== x.x && null !== x.y) {
                            B = i.x - x.x,
                            z = i.y - x.y,
                            y = B * B + z * z;
                            y < x.max && (x === f && y >= x.max / 2 && (i.x -= 0.03 * B, i.y -= 0.03 * z), A = (x.max - y) / x.max, e.beginPath(), e.lineWidth = A / 2, e.strokeStyle = "rgba(" + s.c + "," + (A + 0.2) + ")", e.moveTo(i.x, i.y), e.lineTo(x.x, x.y), e.stroke())
                        }
                    }
                    w.splice(w.indexOf(i), 1)
                }),
                m(b)
            }
            var u = document.createElement("canvas"),
            s = l(),
            c = "c_n" + s.l,
            e = u.getContext("2d"),
            r,
            n,
            m = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
            function(i) {
                window.setTimeout(i, 1000 / 45)
            },
            a = Math.random,
            f = {
                x: null,
                y: null,
                max: 20000
            };
            u.id = c;
            u.style.cssText = "position:fixed;top:0;left:0;z-index:" + s.z + ";opacity:" + s.o;
            j("body")[0].appendChild(u);
            k(),
            window.onresize = k;
            window.onmousemove = function(i) {
                i = i || window.event,
                f.x = i.clientX,
                f.y = i.clientY
            },
            window.onmouseout = function() {
                f.x = null,
                f.y = null
            };
            for (var t = [], p = 0; s.n > p; p++) {
                var h = a() * r,
                g = a() * n,
                q = 2 * a() - 1,
                d = 2 * a() - 1;
                t.push({
                    x: h,
                    y: g,
                    xa: q,
                    ya: d,
                    max: 6000
                })
            }
            setTimeout(function() {
                b()
            }, 100)
    } ();
    </script>
</footer>

        </div>
        
    <script defer src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script>
    <script>
        window.lazyLoadOptions = {
            elements_selector: ".lazy",
            threshold: 0
        };
    </script>
 

 

 

 

 



 



 


    
 


    
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>

    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.4.1/dist/jquery.fancybox.min.css">

    
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.4.1/dist/jquery.fancybox.min.js"></script>

    <script>
        let lazyloadT = Boolean('true'),
            auto_fancybox = Boolean('false')
        if (auto_fancybox) {
            $(".post__content").find('img').each(function () {
                var element = document.createElement("a");
                $(element).attr("data-fancybox", "gallery");
                $(element).attr("href", $(this).attr("src"));
                if (lazyloadT) {
                    $(element).attr("href", $(this).attr("data-srcset"));
                }
                $(this).wrap(element);
            });
        } else {
            $(".post__content").find("fancybox").find('img').each(function () {
                var element = document.createElement("a");
                $(element).attr("data-fancybox", "gallery");
                $(element).attr("href", $(this).attr("src"));
                if (lazyloadT) {
                    $(element).attr("href", $(this).attr("data-srcset"));
                }
                $(this).wrap(element);
            });
        }
    </script>
 

 

 

 

 


    

    
    
    
    <script>
        function loadComment() {
            let e;
            (e = document.createElement("script")).src = 'https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js',
            document.body.appendChild(e);
            e.onload = () => {
                var valineConfig = {"appId":"c21JqSBfScFdueO44Scwp9Ba-gzGzoHsz","appKey":"apETP0QIekHzRXjTHvOnrQmS","placeholder":null,"path":null,"avatar":"retro","meta":["nick","mail","link"],"pageSize":null,"lang":null,"visitor":null,"highlight":null,"avatarForce":null,"recordIP":null,"serverURLs":null,"enableQQ":true,"requiredFields":["nick","mail"],"emojiCDN":null,"emojiMaps":null};
                valineConfig.el = '#valine_container';
                for (var i in valineConfig) {
                    if (valineConfig[i] === null) delete valineConfig[i];
                }
                new Valine(valineConfig);
            };
        }
    
        var runningOnBrowser = typeof window !== "undefined";
        var isBot = runningOnBrowser && !("onscroll" in window) || typeof navigator !== "undefined" && /(gle|ing|ro|msn)bot|crawl|spider|yand|duckgo/i.test(navigator.userAgent);
        var supportsIntersectionObserver = runningOnBrowser && "IntersectionObserver" in window;
    
        setTimeout(function () {
            if (!isBot && supportsIntersectionObserver) {
                var comment_observer = new IntersectionObserver(function(entries) {
                    if (entries[0].isIntersecting) {
                        loadComment();
                        comment_observer.disconnect();
                    }
                }, { threshold: [0] });
                comment_observer.observe(document.getElementById('comment'));
            } else {
                loadComment();
            }
        }, 1);
    </script>


    
    
    
    
    

    
    
    
    
    

    
    
    



    </body>
</html>
